package com.ailk.bigdata.etl.realstream.server.disruptor;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import com.ailk.bigdata.etl.realstream.server.model.ValueEvent;
import com.lmax.disruptor.ExceptionHandler;

public class StreamExceptionHandler implements ExceptionHandler
{
	private static Logger logger = LoggerFactory.getLogger(StreamExceptionHandler.class);

	/**
	 * @see com.lmax.disruptor.ExceptionHandler#handleEventException(java.lang.Throwable,
	 *      long, java.lang.Object)
	 */
	@Override
	public void handleEventException(Throwable ex, long sequence, Object event)
	{
		logger.error("实时流发送异常 单元编号" + ((ValueEvent) event).getDataPackage().getDataType(), ex);
	}

	/**
	 * @see com.lmax.disruptor.ExceptionHandler#handleOnStartException(java.lang.Throwable)
	 */
	@Override
	public void handleOnStartException(Throwable ex)
	{
		logger.error("Exception during onStart()", ex);
	}

	/**
	 * @see com.lmax.disruptor.ExceptionHandler#handleOnShutdownException(java.lang.Throwable)
	 */
	@Override
	public void handleOnShutdownException(Throwable ex)
	{
		logger.error("Exception during onShutdown()", ex);
	}

}
